<?php
/**
 * The Header for Qualeb theme.
 *
 * Displays the Head, the logo and the Navigation
 *
 * @package Qualeb
 * @since Qualeb 1.0
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if IE 6]> <html id="ie6" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]> <html id="ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]> <html id="ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!--> <html <?php language_attributes(); ?>> <!--<![endif]-->
<head>
	<!-- Meta Tags -->
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<?php $page_title = get_post_meta($post->ID, 'dm_he_title', true); ?>
	<!-- Mobile Specific Meta -->
	<?php if( is_home() || is_front_page() ){?>
		<meta name="description" content="345soft 致力于 电子商务系统 深入研究推广，为客户快速打造顶级的电子商务网站" />
		<meta name="keywords" content="电子商务系统 | 电子商务免费模板 | 电子商务服务器 | 电子商务流媒体 | 电子商务移动业务 | erp 系统 | cms系统" />
	<?php }elseif(is_single()){
			$keywords = $flag = "";
			$tags = wp_get_post_tags($post->ID);
			foreach ($tags as $tag ) {
				$keywords .= $flag.$tag->name ;
				$flag=",";
			}
			$category = get_the_category(); 
			$caname=$category ? $category[0]->cat_name : ""; 
	?>	
		<meta name="description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
		<meta name="keywords" content=" <?php if($keywords){ echo $keywords ; }elseif($caname){ echo $caname; };?>" />
	<?php }elseif(is_category()){ ?>
		<meta name="description" content="<?php echo strip_tags(category_description(get_category_by_slug(strtolower(get_the_category()))->term_id)); ?>" />
		<meta name="keywords" content=" <?php echo single_cat_title(); ?> " />
	<?php }else{ ?>
		<meta name="description" content="<?php if ($page_title){ echo $page_title; }else{ echo get_the_title(); }?>" />
		<meta name="keywords" content="<?php echo get_post_meta($post->ID, 'dm_he_desc', true); ?>" />
	<?php } ?>
	<!-- Title -->
	<title><?php
		global $page, $paged;
		wp_title( '|', true, 'right' );
		bloginfo( 'name' );
		$site_description = get_bloginfo( 'description', 'display' );
		if ( $site_description && ( is_home() || is_front_page() ) )
			echo " | $site_description";
		if ( $paged >= 2 || $page >= 2 )
			echo ' | ' . sprintf( __( 'Page %s', 'demagician' ), max( $paged, $page ) );
		?>
	</title>
	 
	<!-- XFN and Pingback -->
	<link rel="canonical" href="<?php the_permalink(); ?>" />
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

	<!-- StyleSheet -->
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic" type="text/css" />
	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/<?php echo of_get_option('qua_skin', 'light'); ?>.css" />
	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/color.php" />
	
	<!--[if lt IE 9]>
	<script src="<?php echo get_template_directory_uri(); ?>/library/js/modernizr-1.7.min.js" type="text/javascript"></script>
	<![endif]-->
    
	<!--[if lte IE 7]>
	<link rel="stylesheet" href="<?php bloginfo( 'template_url' ); ?>/css/ie7.css" type="text/css" media="screen" />
	<script type="text/javascript" src="<?php bloginfo( 'template_url' ); ?>/library/js/DD_belatedPNG.js"></script>
	<script type="text/javascript">
		DD_belatedPNG.fix('div.portfolio-hover, #psingle-nav a, .flex-control-nav li a, div.home-portfolio-hover, .flex-direction-nav li a');
	</script>
	<![endif]-->
    
    
    <?php 
	if (is_page_template( 'home-portfolio.php' ) || is_page_template( 'archive-portfolio.php' ) ) {
	?>
    <!-- Fixes the disappearing browser scrollbar, when we don't have too many items showing in portfolio -->
	<style type="text/css"> 
		html{overflow-y: scroll;}
	</style>
	<!-- -->
    <?php } ?>

	<!-- wp Head-->
	<?php
		if ( is_singular() && get_option( 'thread_comments' ) )
			wp_enqueue_script( 'comment-reply' );
		wp_head();
	?>
</head>

<body <?php body_class(); ?>  style="TEXT-ALIGN: center;margin: 0px auto;background: url('./wp-content/themes/qualeb_CN/css/images/background.png') repeat-x scroll 0 0 #FFFFFF;">
<div id="page" class="homepage" data-color="<?php echo of_get_option('qua_color'); ?>" style="TEXT-ALIGN: left;" >
	<div id="header" class="clearfix">
		<div id="logo">
				<a href="<?php echo get_bloginfo('url') ?>">
					<?php if ( of_get_option('qua_logo') ) { ?>
					<img class="logo" src="<?php echo of_get_option('qua_logo'); ?>" />
					<?php } ?>
				</a>
		</div><!-- #logo -->
		<div id="header-content">
			<!-- Large Screens Navigation -->
			<div id="access" role="navigation">
					<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => 'div', 'menu_class' => 'menu', 'container_class' => 'menu',  ) ); ?>
			</div><!-- #access -->
			
			<!-- Small Screens Navigation -->
			<nav id="responsiveaccess">
			<select name="page-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 
				<option value="<?php echo get_bloginfo('url') ?>">
				<?php echo esc_attr( __( 'Home' ) ); ?></option> 
				<?php 
				$pages = get_pages(); 
				foreach ( $pages as $pagg ) {
				$option = '<option value="' . get_page_link( $pagg->ID ) . '">';
				$option .= $pagg->post_title;
				$option .= '</option>';
				echo $option;
				}
				?>
			</select>
			</nav> <!-- #responsiveaccess -->